package com.dzjcloud.dzj.upms.biz.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.dzjcloud.dzj.common.core.utils.R;
import com.dzjcloud.dzj.common.satoken.CurrentLogin;
import com.dzjcloud.dzj.common.satoken.entity.SatokenUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.klock.annotation.Klock;
import org.springframework.boot.autoconfigure.klock.model.LockTimeoutStrategy;
import org.springframework.boot.autoconfigure.klock.model.LockType;
import org.springframework.boot.autoconfigure.klock.model.ReleaseTimeoutStrategy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.concurrent.TimeUnit;

import static org.springframework.boot.autoconfigure.klock.model.LockTimeoutStrategy.FAIL_FAST;
import static org.springframework.boot.autoconfigure.klock.model.LockTimeoutStrategy.KEEP_ACQUIRE;

/**
 * <h3>dzj-cloud</h3>
 * <p>测试控制器</p>
 *
 * @author : DongZeJian
 * @date : 2021-04-30 15:21
 **/
@RestController
@Slf4j
@RequestMapping("/test")
public class TestController {


    @GetMapping
    @SaIgnore

    public R<String> test(@RequestParam String id) throws InterruptedException {
        return R.ok("你好 董泽建微服务:"+id);
    }

    @GetMapping("/currentLogin")
    public R<SatokenUser> currentLogin(){
        return R.ok(CurrentLogin.currentLoginUser());
    }
}
